package com.ruoyi.game.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.game.domain.GameWithdrawalConfig;
import com.ruoyi.game.service.IGameWithdrawalConfigService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 提现设置Controller
 * 
 * @author ruoyi
 * @date 2024-03-23
 */
@RestController
@RequestMapping("/game/withdrawal_config")
public class GameWithdrawalConfigController extends BaseController
{
    @Autowired
    private IGameWithdrawalConfigService gameWithdrawalConfigService;

    /**
     * 查询提现设置列表
     */
    @PreAuthorize("@ss.hasPermi('game:withdrawal_config:list')")
    @GetMapping("/list")
    public TableDataInfo list(GameWithdrawalConfig gameWithdrawalConfig)
    {
        startPage();
        List<GameWithdrawalConfig> list = gameWithdrawalConfigService.selectGameWithdrawalConfigList(gameWithdrawalConfig);
        return getDataTable(list);
    }

    /**
     * 导出提现设置列表
     */
    @PreAuthorize("@ss.hasPermi('game:withdrawal_config:export')")
    @Log(title = "提现设置", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, GameWithdrawalConfig gameWithdrawalConfig)
    {
        List<GameWithdrawalConfig> list = gameWithdrawalConfigService.selectGameWithdrawalConfigList(gameWithdrawalConfig);
        ExcelUtil<GameWithdrawalConfig> util = new ExcelUtil<GameWithdrawalConfig>(GameWithdrawalConfig.class);
        util.exportExcel(response, list, "提现设置数据");
    }

    /**
     * 获取提现设置详细信息
     */
    @PreAuthorize("@ss.hasPermi('game:withdrawal_config:query')")
    @GetMapping(value = "/{withdrawalConfigId}")
    public AjaxResult getInfo(@PathVariable("withdrawalConfigId") Long withdrawalConfigId)
    {
        return success(gameWithdrawalConfigService.selectGameWithdrawalConfigByWithdrawalConfigId(withdrawalConfigId));
    }

    /**
     * 新增提现设置
     */
    @PreAuthorize("@ss.hasPermi('game:withdrawal_config:add')")
    @Log(title = "提现设置", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody GameWithdrawalConfig gameWithdrawalConfig)
    {
        return toAjax(gameWithdrawalConfigService.insertGameWithdrawalConfig(gameWithdrawalConfig));
    }

    /**
     * 修改提现设置
     */
    @PreAuthorize("@ss.hasPermi('game:withdrawal_config:edit')")
    @Log(title = "提现设置", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody GameWithdrawalConfig gameWithdrawalConfig)
    {
        return toAjax(gameWithdrawalConfigService.updateGameWithdrawalConfig(gameWithdrawalConfig));
    }

    /**
     * 删除提现设置
     */
    @PreAuthorize("@ss.hasPermi('game:withdrawal_config:remove')")
    @Log(title = "提现设置", businessType = BusinessType.DELETE)
	@DeleteMapping("/{withdrawalConfigIds}")
    public AjaxResult remove(@PathVariable Long[] withdrawalConfigIds)
    {
        return toAjax(gameWithdrawalConfigService.deleteGameWithdrawalConfigByWithdrawalConfigIds(withdrawalConfigIds));
    }
}
